package com.guoliang.oss.controller;

import com.guoliang.commonUtils.CommonResult;
import com.guoliang.oss.service.OssService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author ：Leo
 * @date ：Created in 2023/1/17 10:23
 * @description：
 */
@RestController
@RequestMapping("/eduoss/fileoss")
public class OssController {
    @Autowired
    private OssService ossService;
    @ApiOperation("文件上传")
    @PostMapping("upload")
    public CommonResult upload(MultipartFile file){
        String url=ossService.uploadFileAvatar(file);
        return CommonResult.ok().data("url",url);
    }
}
